package com.example.common;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;


@Data
public class Ajaxresult {
    private Integer code;
    private String msg;
    private Object data;
    public static Ajaxresult success(Object data){
        Ajaxresult ajaxresult=new Ajaxresult();
          ajaxresult.setCode(200);
          ajaxresult.setData(data);
          return ajaxresult;
    }
    public static Ajaxresult success(String msg,Object data){
        Ajaxresult ajaxresult=new Ajaxresult();
        ajaxresult.setCode(200);
        ajaxresult.setData(data);
        ajaxresult.setMsg(msg);
        return ajaxresult;
    }
    public static Ajaxresult fail(Integer code,String msg){
        Ajaxresult ajaxresult=new Ajaxresult();
        ajaxresult.setCode(code);
        ajaxresult.setMsg(msg);
        return ajaxresult;
    }
    public static Ajaxresult fail(Integer code,String msg,Object data){
        Ajaxresult ajaxresult=new Ajaxresult();
        ajaxresult.setCode(code);
        ajaxresult.setData(data);
        ajaxresult.setMsg(msg);
        return ajaxresult;
    }

}
